namespace Engine
{
  using System;
  using System.ComponentModel;
  using System.Globalization;
  using System.Runtime.InteropServices;
    using SharpDX;
  [Serializable, StructLayout(LayoutKind.Sequential)]
  public struct DVector3 : IEquatable<DVector3>
  {
      public double X;
      public double Y;
      public double Z;
    private static DVector3 _zero;
    private static DVector3 _one;
    private static DVector3 _unitX;
    private static DVector3 _unitY;
    private static DVector3 _unitZ;
    private static DVector3 _up;
    private static DVector3 _down;
    private static DVector3 _right;
    private static DVector3 _left;
    private static DVector3 _forward;
    private static DVector3 _backward;
    public static DVector3 Zero
    {
      get
      {
        return _zero;
      }
    }
    public static DVector3 One
    {
      get
      {
        return _one;
      }
    }
    public static DVector3 UnitX
    {
      get
      {
        return _unitX;
      }
    }
    public static DVector3 UnitY
    {
      get
      {
        return _unitY;
      }
    }
    public static DVector3 UnitZ
    {
      get
      {
        return _unitZ;
      }
    }
    public static DVector3 Up
    {
      get
      {
        return _up;
      }
    }
    public static DVector3 Down
    {
      get
      {
        return _down;
      }
    }
    public static DVector3 Right
    {
      get
      {
        return _right;
      }
    }
    public static DVector3 Left
    {
      get
      {
        return _left;
      }
    }
    public static DVector3 Forward
    {
      get
      {
        return _forward;
      }
    }
    public static DVector3 Backward
    {
      get
      {
        return _backward;
      }
    }
    public DVector3(double x, double y, double z)
    {
      this.X = x;
      this.Y = y;
      this.Z = z;
    }

    public DVector3(double value)
    {
      this.X = this.Y = this.Z = value;
    }
    
    
    public override string ToString()
    {
      CultureInfo currentCulture = CultureInfo.CurrentCulture;
      return string.Format(currentCulture, "{{X:{0} Y:{1} Z:{2}}}", new object[] { this.X.ToString(currentCulture), this.Y.ToString(currentCulture), this.Z.ToString(currentCulture) });
    }
    
    public bool Equals(DVector3 other)
    {
      return (((this.X == other.X) && (this.Y == other.Y)) && (this.Z == other.Z));
    }
    
    public override bool Equals(object obj)
    {
      bool flag = false;
      if (obj is DVector3)
      {
        flag = this.Equals((DVector3) obj);
      }
      return flag;
    }
    
    public override int GetHashCode()
    {
      return ((this.X.GetHashCode() + this.Y.GetHashCode()) + this.Z.GetHashCode());
    }

    public double Length()
    {
        double num = ((this.X * this.X) + (this.Y * this.Y)) + (this.Z * this.Z);
      return Math.Sqrt((double) num);
    }

    public double LengthSquared()
    {
      return (((this.X * this.X) + (this.Y * this.Y)) + (this.Z * this.Z));
    }

    public static double Distance(DVector3 value1, DVector3 value2)
    {
        double num3 = value1.X - value2.X;
        double num2 = value1.Y - value2.Y;
        double num = value1.Z - value2.Z;
        double num4 = ((num3 * num3) + (num2 * num2)) + (num * num);
      return Math.Sqrt(num4);
    }

    public static void Distance(ref DVector3 value1, ref DVector3 value2, out double result)
    {
        double num3 = value1.X - value2.X;
        double num2 = value1.Y - value2.Y;
        double num = value1.Z - value2.Z;
        double num4 = ((num3 * num3) + (num2 * num2)) + (num * num);
      result = Math.Sqrt(num4);
    }

    public static double DistanceSquared(DVector3 value1, DVector3 value2)
    {
        double num3 = value1.X - value2.X;
        double num2 = value1.Y - value2.Y;
        double num = value1.Z - value2.Z;
      return (((num3 * num3) + (num2 * num2)) + (num * num));
    }

    public static void DistanceSquared(ref DVector3 value1, ref DVector3 value2, out double result)
    {
        double num3 = value1.X - value2.X;
        double num2 = value1.Y - value2.Y;
        double num = value1.Z - value2.Z;
      result = ((num3 * num3) + (num2 * num2)) + (num * num);
    }

    public static double Dot(DVector3 vector1, DVector3 vector2)
    {
      return (((vector1.X * vector2.X) + (vector1.Y * vector2.Y)) + (vector1.Z * vector2.Z));
    }

    public static void Dot(ref DVector3 vector1, ref DVector3 vector2, out double result)
    {
      result = ((vector1.X * vector2.X) + (vector1.Y * vector2.Y)) + (vector1.Z * vector2.Z);
    }
    
    public void Normalize()
    {
        double num2 = ((this.X * this.X) + (this.Y * this.Y)) + (this.Z * this.Z);
        double num = 1f / (Math.Sqrt(num2));
      this.X *= num;
      this.Y *= num;
      this.Z *= num;
    }
    
    public static DVector3 Normalize(DVector3 value)
    {
      DVector3 vector;
      double num2 = ((value.X * value.X) + (value.Y * value.Y)) + (value.Z * value.Z);
      double num = 1f / (Math.Sqrt(num2));
      vector.X = value.X * num;
      vector.Y = value.Y * num;
      vector.Z = value.Z * num;
      return vector;
    }
    
    public static void Normalize(ref DVector3 value, out DVector3 result)
    {
        double num2 = ((value.X * value.X) + (value.Y * value.Y)) + (value.Z * value.Z);
        double num = 1f / (Math.Sqrt(num2));
      result.X = value.X * num;
      result.Y = value.Y * num;
      result.Z = value.Z * num;
    }
    
    public static DVector3 Cross(DVector3 vector1, DVector3 vector2)
    {
      DVector3 vector;
      vector.X = (vector1.Y * vector2.Z) - (vector1.Z * vector2.Y);
      vector.Y = (vector1.Z * vector2.X) - (vector1.X * vector2.Z);
      vector.Z = (vector1.X * vector2.Y) - (vector1.Y * vector2.X);
      return vector;
    }
    
    public static void Cross(ref DVector3 vector1, ref DVector3 vector2, out DVector3 result)
    {
        double num3 = (vector1.Y * vector2.Z) - (vector1.Z * vector2.Y);
        double num2 = (vector1.Z * vector2.X) - (vector1.X * vector2.Z);
        double num = (vector1.X * vector2.Y) - (vector1.Y * vector2.X);
      result.X = num3;
      result.Y = num2;
      result.Z = num;
    }
    
    public static DVector3 Reflect(DVector3 vector, DVector3 normal)
    {
      DVector3 vector2;
      double num = ((vector.X * normal.X) + (vector.Y * normal.Y)) + (vector.Z * normal.Z);
      vector2.X = vector.X - ((2f * num) * normal.X);
      vector2.Y = vector.Y - ((2f * num) * normal.Y);
      vector2.Z = vector.Z - ((2f * num) * normal.Z);
      return vector2;
    }
    
    public static void Reflect(ref DVector3 vector, ref DVector3 normal, out DVector3 result)
    {
        double num = ((vector.X * normal.X) + (vector.Y * normal.Y)) + (vector.Z * normal.Z);
      result.X = vector.X - ((2f * num) * normal.X);
      result.Y = vector.Y - ((2f * num) * normal.Y);
      result.Z = vector.Z - ((2f * num) * normal.Z);
    }
    
    public static DVector3 Min(DVector3 value1, DVector3 value2)
    {
      DVector3 vector;
      vector.X = (value1.X < value2.X) ? value1.X : value2.X;
      vector.Y = (value1.Y < value2.Y) ? value1.Y : value2.Y;
      vector.Z = (value1.Z < value2.Z) ? value1.Z : value2.Z;
      return vector;
    }
    
    public static void Min(ref DVector3 value1, ref DVector3 value2, out DVector3 result)
    {
      result.X = (value1.X < value2.X) ? value1.X : value2.X;
      result.Y = (value1.Y < value2.Y) ? value1.Y : value2.Y;
      result.Z = (value1.Z < value2.Z) ? value1.Z : value2.Z;
    }
    
    public static DVector3 Max(DVector3 value1, DVector3 value2)
    {
      DVector3 vector;
      vector.X = (value1.X > value2.X) ? value1.X : value2.X;
      vector.Y = (value1.Y > value2.Y) ? value1.Y : value2.Y;
      vector.Z = (value1.Z > value2.Z) ? value1.Z : value2.Z;
      return vector;
    }
    
    public static void Max(ref DVector3 value1, ref DVector3 value2, out DVector3 result)
    {
      result.X = (value1.X > value2.X) ? value1.X : value2.X;
      result.Y = (value1.Y > value2.Y) ? value1.Y : value2.Y;
      result.Z = (value1.Z > value2.Z) ? value1.Z : value2.Z;
    }
    
    public static DVector3 Clamp(DVector3 value1, DVector3 min, DVector3 max)
    {
      DVector3 vector;
      double x = value1.X;
      x = (x > max.X) ? max.X : x;
      x = (x < min.X) ? min.X : x;
      double y = value1.Y;
      y = (y > max.Y) ? max.Y : y;
      y = (y < min.Y) ? min.Y : y;
      double z = value1.Z;
      z = (z > max.Z) ? max.Z : z;
      z = (z < min.Z) ? min.Z : z;
      vector.X = x;
      vector.Y = y;
      vector.Z = z;
      return vector;
    }
    
    public static void Clamp(ref DVector3 value1, ref DVector3 min, ref DVector3 max, out DVector3 result)
    {
        double x = value1.X;
      x = (x > max.X) ? max.X : x;
      x = (x < min.X) ? min.X : x;
      double y = value1.Y;
      y = (y > max.Y) ? max.Y : y;
      y = (y < min.Y) ? min.Y : y;
      double z = value1.Z;
      z = (z > max.Z) ? max.Z : z;
      z = (z < min.Z) ? min.Z : z;
      result.X = x;
      result.Y = y;
      result.Z = z;
    }

    public static DVector3 Lerp(DVector3 value1, DVector3 value2, double amount)
    {
      DVector3 vector;
      vector.X = value1.X + ((value2.X - value1.X) * amount);
      vector.Y = value1.Y + ((value2.Y - value1.Y) * amount);
      vector.Z = value1.Z + ((value2.Z - value1.Z) * amount);
      return vector;
    }

    public static void Lerp(ref DVector3 value1, ref DVector3 value2, double amount, out DVector3 result)
    {
      result.X = value1.X + ((value2.X - value1.X) * amount);
      result.Y = value1.Y + ((value2.Y - value1.Y) * amount);
      result.Z = value1.Z + ((value2.Z - value1.Z) * amount);
    }

    public static DVector3 Barycentric(DVector3 value1, DVector3 value2, DVector3 value3, double amount1, double amount2)
    {
      DVector3 vector;
      vector.X = (value1.X + (amount1 * (value2.X - value1.X))) + (amount2 * (value3.X - value1.X));
      vector.Y = (value1.Y + (amount1 * (value2.Y - value1.Y))) + (amount2 * (value3.Y - value1.Y));
      vector.Z = (value1.Z + (amount1 * (value2.Z - value1.Z))) + (amount2 * (value3.Z - value1.Z));
      return vector;
    }

    public static void Barycentric(ref DVector3 value1, ref DVector3 value2, ref DVector3 value3, double amount1, double amount2, out DVector3 result)
    {
      result.X = (value1.X + (amount1 * (value2.X - value1.X))) + (amount2 * (value3.X - value1.X));
      result.Y = (value1.Y + (amount1 * (value2.Y - value1.Y))) + (amount2 * (value3.Y - value1.Y));
      result.Z = (value1.Z + (amount1 * (value2.Z - value1.Z))) + (amount2 * (value3.Z - value1.Z));
    }

    public static DVector3 SmoothStep(DVector3 value1, DVector3 value2, double amount)
    {
      DVector3 vector;
      amount = (amount > 1f) ? 1f : ((amount < 0f) ? 0f : amount);
      amount = (amount * amount) * (3f - (2f * amount));
      vector.X = value1.X + ((value2.X - value1.X) * amount);
      vector.Y = value1.Y + ((value2.Y - value1.Y) * amount);
      vector.Z = value1.Z + ((value2.Z - value1.Z) * amount);
      return vector;
    }

    public static void SmoothStep(ref DVector3 value1, ref DVector3 value2, double amount, out DVector3 result)
    {
      amount = (amount > 1f) ? 1f : ((amount < 0f) ? 0f : amount);
      amount = (amount * amount) * (3f - (2f * amount));
      result.X = value1.X + ((value2.X - value1.X) * amount);
      result.Y = value1.Y + ((value2.Y - value1.Y) * amount);
      result.Z = value1.Z + ((value2.Z - value1.Z) * amount);
    }

    public static DVector3 CatmullRom(DVector3 value1, DVector3 value2, DVector3 value3, DVector3 value4, double amount)
    {
      DVector3 vector;
      double num = amount * amount;
      double num2 = amount * num;
      vector.X = 0.5f * ((((2f * value2.X) + ((-value1.X + value3.X) * amount)) + (((((2f * value1.X) - (5f * value2.X)) + (4f * value3.X)) - value4.X) * num)) + ((((-value1.X + (3f * value2.X)) - (3f * value3.X)) + value4.X) * num2));
      vector.Y = 0.5f * ((((2f * value2.Y) + ((-value1.Y + value3.Y) * amount)) + (((((2f * value1.Y) - (5f * value2.Y)) + (4f * value3.Y)) - value4.Y) * num)) + ((((-value1.Y + (3f * value2.Y)) - (3f * value3.Y)) + value4.Y) * num2));
      vector.Z = 0.5f * ((((2f * value2.Z) + ((-value1.Z + value3.Z) * amount)) + (((((2f * value1.Z) - (5f * value2.Z)) + (4f * value3.Z)) - value4.Z) * num)) + ((((-value1.Z + (3f * value2.Z)) - (3f * value3.Z)) + value4.Z) * num2));
      return vector;
    }

    public static void CatmullRom(ref DVector3 value1, ref DVector3 value2, ref DVector3 value3, ref DVector3 value4, double amount, out DVector3 result)
    {
        double num = amount * amount;
        double num2 = amount * num;
      result.X = 0.5f * ((((2f * value2.X) + ((-value1.X + value3.X) * amount)) + (((((2f * value1.X) - (5f * value2.X)) + (4f * value3.X)) - value4.X) * num)) + ((((-value1.X + (3f * value2.X)) - (3f * value3.X)) + value4.X) * num2));
      result.Y = 0.5f * ((((2f * value2.Y) + ((-value1.Y + value3.Y) * amount)) + (((((2f * value1.Y) - (5f * value2.Y)) + (4f * value3.Y)) - value4.Y) * num)) + ((((-value1.Y + (3f * value2.Y)) - (3f * value3.Y)) + value4.Y) * num2));
      result.Z = 0.5f * ((((2f * value2.Z) + ((-value1.Z + value3.Z) * amount)) + (((((2f * value1.Z) - (5f * value2.Z)) + (4f * value3.Z)) - value4.Z) * num)) + ((((-value1.Z + (3f * value2.Z)) - (3f * value3.Z)) + value4.Z) * num2));
    }

    public static DVector3 Hermite(DVector3 value1, DVector3 tangent1, DVector3 value2, DVector3 tangent2, double amount)
    {
      DVector3 vector;
      double num = amount * amount;
      double num2 = amount * num;
      double num6 = ((2f * num2) - (3f * num)) + 1f;
      double num5 = (-2f * num2) + (3f * num);
      double num4 = (num2 - (2f * num)) + amount;
      double num3 = num2 - num;
      vector.X = (((value1.X * num6) + (value2.X * num5)) + (tangent1.X * num4)) + (tangent2.X * num3);
      vector.Y = (((value1.Y * num6) + (value2.Y * num5)) + (tangent1.Y * num4)) + (tangent2.Y * num3);
      vector.Z = (((value1.Z * num6) + (value2.Z * num5)) + (tangent1.Z * num4)) + (tangent2.Z * num3);
      return vector;
    }

    public static void Hermite(ref DVector3 value1, ref DVector3 tangent1, ref DVector3 value2, ref DVector3 tangent2, double amount, out DVector3 result)
    {
        double num = amount * amount;
        double num2 = amount * num;
        double num6 = ((2f * num2) - (3f * num)) + 1f;
        double num5 = (-2f * num2) + (3f * num);
        double num4 = (num2 - (2f * num)) + amount;
        double num3 = num2 - num;
      result.X = (((value1.X * num6) + (value2.X * num5)) + (tangent1.X * num4)) + (tangent2.X * num3);
      result.Y = (((value1.Y * num6) + (value2.Y * num5)) + (tangent1.Y * num4)) + (tangent2.Y * num3);
      result.Z = (((value1.Z * num6) + (value2.Z * num5)) + (tangent1.Z * num4)) + (tangent2.Z * num3);
    }

    public static DVector3 Transform(DVector3 position, DMatrix matrix)
    {
        DVector3 vector;
        double num3 = (((position.X * matrix.M11) + (position.Y * matrix.M21)) + (position.Z * matrix.M31)) + matrix.M41;
        double num2 = (((position.X * matrix.M12) + (position.Y * matrix.M22)) + (position.Z * matrix.M32)) + matrix.M42;
        double num = (((position.X * matrix.M13) + (position.Y * matrix.M23)) + (position.Z * matrix.M33)) + matrix.M43;
        vector.X = num3;
        vector.Y = num2;
        vector.Z = num;
        return vector;
    }

    public static void Transform(ref DVector3 position, ref DMatrix matrix, out DVector3 result)
    {
        double num3 = (((position.X * matrix.M11) + (position.Y * matrix.M21)) + (position.Z * matrix.M31)) + matrix.M41;
        double num2 = (((position.X * matrix.M12) + (position.Y * matrix.M22)) + (position.Z * matrix.M32)) + matrix.M42;
        double num = (((position.X * matrix.M13) + (position.Y * matrix.M23)) + (position.Z * matrix.M33)) + matrix.M43;
        result.X = num3;
        result.Y = num2;
        result.Z = num;
    }

    public static DVector3 TransformNormal(DVector3 normal, DMatrix matrix)
    {
        DVector3 vector;
        double num3 = ((normal.X * matrix.M11) + (normal.Y * matrix.M21)) + (normal.Z * matrix.M31);
        double num2 = ((normal.X * matrix.M12) + (normal.Y * matrix.M22)) + (normal.Z * matrix.M32);
        double num = ((normal.X * matrix.M13) + (normal.Y * matrix.M23)) + (normal.Z * matrix.M33);
        vector.X = num3;
        vector.Y = num2;
        vector.Z = num;
        return vector;
    }

    public static void TransformNormal(ref DVector3 normal, ref DMatrix matrix, out DVector3 result)
    {
        double num3 = ((normal.X * matrix.M11) + (normal.Y * matrix.M21)) + (normal.Z * matrix.M31);
        double num2 = ((normal.X * matrix.M12) + (normal.Y * matrix.M22)) + (normal.Z * matrix.M32);
        double num = ((normal.X * matrix.M13) + (normal.Y * matrix.M23)) + (normal.Z * matrix.M33);
        result.X = num3;
        result.Y = num2;
        result.Z = num;
    }

    public static DVector3 Transform(DVector3 value, DQuaternion rotation)
    {
        DVector3 vector;
        double num12 = rotation.X + rotation.X;
        double num2 = rotation.Y + rotation.Y;
        double num = rotation.Z + rotation.Z;
        double num11 = rotation.W * num12;
        double num10 = rotation.W * num2;
        double num9 = rotation.W * num;
        double num8 = rotation.X * num12;
        double num7 = rotation.X * num2;
        double num6 = rotation.X * num;
        double num5 = rotation.Y * num2;
        double num4 = rotation.Y * num;
        double num3 = rotation.Z * num;
        double num15 = ((value.X * ((1f - num5) - num3)) + (value.Y * (num7 - num9))) + (value.Z * (num6 + num10));
        double num14 = ((value.X * (num7 + num9)) + (value.Y * ((1f - num8) - num3))) + (value.Z * (num4 - num11));
        double num13 = ((value.X * (num6 - num10)) + (value.Y * (num4 + num11))) + (value.Z * ((1f - num8) - num5));
        vector.X = num15;
        vector.Y = num14;
        vector.Z = num13;
        return vector;
    }

    public static void Transform(ref DVector3 value, ref DQuaternion rotation, out DVector3 result)
    {
        double num12 = rotation.X + rotation.X;
        double num2 = rotation.Y + rotation.Y;
        double num = rotation.Z + rotation.Z;
        double num11 = rotation.W * num12;
        double num10 = rotation.W * num2;
        double num9 = rotation.W * num;
        double num8 = rotation.X * num12;
        double num7 = rotation.X * num2;
        double num6 = rotation.X * num;
        double num5 = rotation.Y * num2;
        double num4 = rotation.Y * num;
        double num3 = rotation.Z * num;
        double num15 = ((value.X * ((1f - num5) - num3)) + (value.Y * (num7 - num9))) + (value.Z * (num6 + num10));
        double num14 = ((value.X * (num7 + num9)) + (value.Y * ((1f - num8) - num3))) + (value.Z * (num4 - num11));
        double num13 = ((value.X * (num6 - num10)) + (value.Y * (num4 + num11))) + (value.Z * ((1f - num8) - num5));
        result.X = num15;
        result.Y = num14;
        result.Z = num13;
    }

    public static DVector3 Negate(DVector3 value)
    {
      DVector3 vector;
      vector.X = -value.X;
      vector.Y = -value.Y;
      vector.Z = -value.Z;
      return vector;
    }
    
    public static void Negate(ref DVector3 value, out DVector3 result)
    {
      result.X = -value.X;
      result.Y = -value.Y;
      result.Z = -value.Z;
    }
    
    public static DVector3 Add(DVector3 value1, DVector3 value2)
    {
      DVector3 vector;
      vector.X = value1.X + value2.X;
      vector.Y = value1.Y + value2.Y;
      vector.Z = value1.Z + value2.Z;
      return vector;
    }
    
    public static void Add(ref DVector3 value1, ref DVector3 value2, out DVector3 result)
    {
      result.X = value1.X + value2.X;
      result.Y = value1.Y + value2.Y;
      result.Z = value1.Z + value2.Z;
    }
    
    public static DVector3 Subtract(DVector3 value1, DVector3 value2)
    {
      DVector3 vector;
      vector.X = value1.X - value2.X;
      vector.Y = value1.Y - value2.Y;
      vector.Z = value1.Z - value2.Z;
      return vector;
    }
    
    public static void Subtract(ref DVector3 value1, ref DVector3 value2, out DVector3 result)
    {
      result.X = value1.X - value2.X;
      result.Y = value1.Y - value2.Y;
      result.Z = value1.Z - value2.Z;
    }
    
    public static DVector3 Multiply(DVector3 value1, DVector3 value2)
    {
      DVector3 vector;
      vector.X = value1.X * value2.X;
      vector.Y = value1.Y * value2.Y;
      vector.Z = value1.Z * value2.Z;
      return vector;
    }
    
    public static void Multiply(ref DVector3 value1, ref DVector3 value2, out DVector3 result)
    {
      result.X = value1.X * value2.X;
      result.Y = value1.Y * value2.Y;
      result.Z = value1.Z * value2.Z;
    }

    public static DVector3 Multiply(DVector3 value1, double scaleFactor)
    {
      DVector3 vector;
      vector.X = value1.X * scaleFactor;
      vector.Y = value1.Y * scaleFactor;
      vector.Z = value1.Z * scaleFactor;
      return vector;
    }

    public static void Multiply(ref DVector3 value1, double scaleFactor, out DVector3 result)
    {
      result.X = value1.X * scaleFactor;
      result.Y = value1.Y * scaleFactor;
      result.Z = value1.Z * scaleFactor;
    }
    
    public static DVector3 Divide(DVector3 value1, DVector3 value2)
    {
      DVector3 vector;
      vector.X = value1.X / value2.X;
      vector.Y = value1.Y / value2.Y;
      vector.Z = value1.Z / value2.Z;
      return vector;
    }
    
    public static void Divide(ref DVector3 value1, ref DVector3 value2, out DVector3 result)
    {
      result.X = value1.X / value2.X;
      result.Y = value1.Y / value2.Y;
      result.Z = value1.Z / value2.Z;
    }

    public static DVector3 Divide(DVector3 value1, double value2)
    {
      DVector3 vector;
      double num = 1f / value2;
      vector.X = value1.X * num;
      vector.Y = value1.Y * num;
      vector.Z = value1.Z * num;
      return vector;
    }

    public static void Divide(ref DVector3 value1, double value2, out DVector3 result)
    {
        double num = 1f / value2;
      result.X = value1.X * num;
      result.Y = value1.Y * num;
      result.Z = value1.Z * num;
    }
    
    public static DVector3 operator -(DVector3 value)
    {
      DVector3 vector;
      vector.X = -value.X;
      vector.Y = -value.Y;
      vector.Z = -value.Z;
      return vector;
    }
    
    public static bool operator ==(DVector3 value1, DVector3 value2)
    {
      return (((value1.X == value2.X) && (value1.Y == value2.Y)) && (value1.Z == value2.Z));
    }
    
    public static bool operator !=(DVector3 value1, DVector3 value2)
    {
      if ((value1.X == value2.X) && (value1.Y == value2.Y))
      {
        return !(value1.Z == value2.Z);
      }
      return true;
    }
    
    public static DVector3 operator +(DVector3 value1, DVector3 value2)
    {
      DVector3 vector;
      vector.X = value1.X + value2.X;
      vector.Y = value1.Y + value2.Y;
      vector.Z = value1.Z + value2.Z;
      return vector;
    }
    
    public static DVector3 operator -(DVector3 value1, DVector3 value2)
    {
      DVector3 vector;
      vector.X = value1.X - value2.X;
      vector.Y = value1.Y - value2.Y;
      vector.Z = value1.Z - value2.Z;
      return vector;
    }
    
    public static DVector3 operator *(DVector3 value1, DVector3 value2)
    {
      DVector3 vector;
      vector.X = value1.X * value2.X;
      vector.Y = value1.Y * value2.Y;
      vector.Z = value1.Z * value2.Z;
      return vector;
    }

    public static DVector3 operator *(DVector3 value, double scaleFactor)
    {
      DVector3 vector;
      vector.X = value.X * scaleFactor;
      vector.Y = value.Y * scaleFactor;
      vector.Z = value.Z * scaleFactor;
      return vector;
    }

    public static DVector3 operator *(double scaleFactor, DVector3 value)
    {
      DVector3 vector;
      vector.X = value.X * scaleFactor;
      vector.Y = value.Y * scaleFactor;
      vector.Z = value.Z * scaleFactor;
      return vector;
    }
    
    public static DVector3 operator /(DVector3 value1, DVector3 value2)
    {
      DVector3 vector;
      vector.X = value1.X / value2.X;
      vector.Y = value1.Y / value2.Y;
      vector.Z = value1.Z / value2.Z;
      return vector;
    }

    public static DVector3 operator /(DVector3 value, double divider)
    {
      DVector3 vector;
      double num = 1f / divider;
      vector.X = value.X * num;
      vector.Y = value.Y * num;
      vector.Z = value.Z * num;
      return vector;
    }
    
    static DVector3()
    {
      _zero = new DVector3();
      _one = new DVector3(1f, 1f, 1f);
      _unitX = new DVector3(1f, 0f, 0f);
      _unitY = new DVector3(0f, 1f, 0f);
      _unitZ = new DVector3(0f, 0f, 1f);
      _up = new DVector3(0f, 1f, 0f);
      _down = new DVector3(0f, -1f, 0f);
      _right = new DVector3(1f, 0f, 0f);
      _left = new DVector3(-1f, 0f, 0f);
      _forward = new DVector3(0f, 0f, -1f);
      _backward = new DVector3(0f, 0f, 1f);
    }

    public static implicit operator Vector3(DVector3 value)
    {
        return new Vector3((float)value.X, (float)value.Y, (float)value.Z);
    }
  }
}
